Installation
Rust
[dependencies]
docx-rs = "0.4"
Browser/Node.js
$ yarn add docx-wasm
Example
Rust
use *;
Browser
import from "file-saver";
// // Note that a dynamic `import` statement here is required due to webpack/webpack#6615,
import.;
Node.js
const w = require;
const = require;
const =
.
.;
;
More examples
Development
Requirements
- Node.js 16+
- yarn 1+
- wasm-pack0.10.1 (https://rustwasm.github.io/wasm-pack/)
- insta (https://github.com/mitsuhiko/insta)
Examples
You can run example with following code.
Please see examples
directory.
For Example if you want to run hello
example.
Please run following command.
So you can see output file in output directory.
Testing
Rust
Please run following command.
make lint && make test
If snapshot testing is failed, fix code or update snapshot files. (See https://insta.rs/).
$ cargo-insta review
Then re run test.
$ make test
Wasm
Please run following command.
$ cd docx-wasm && yarn install && yarn test
If snapshot testing is failed, fix code or update snapshot files. (See https://jestjs.io/docs/snapshot-testing).
$ yarn test -- --updateSnapshot
Features
- Paragraph
- Alignment
- Indent
- Numbering
- Run
- Bold
- Size
- Font
- Color
- Highlight
- Underline
- vanish
- Italic
- TextBorder
- Break
- Header
- Footer
- Comment
- Image
- Style
- Table
- HIstory
- Table of contents
- Section
- Textbox